package com.hrg.rds.biz.robot.domain;

import lombok.Data;

import java.util.List;

@Data
public class Roller extends Ret {

	// 运行模式 false = 手动, true = 自动
	private boolean roller_mode;
	// 运行状态, 0x01 = 待机, 0x02 = 执行中, 0x03 = 执行完成, 0x04 = 停止, 0xFF = 执行失败
	private int roller_state;
	// 辊筒是否启用, false = 未启用, true = 启用
	private boolean roller_enable;
	// 辊筒错误码
	private int roller_error_code;
	// 辊筒上是否有料, false = 无料, true = 有料
	private boolean roller_isFull;
	// 辊筒电机速率
	private int roller_speed;
	// 辊筒是否急停, false = 未急停, true = 急停
	private boolean roller_emc;
	// 外设中的用户自定义数据
	private List<Integer> peripheral_data;

	public boolean preloadSuccess() {
		return roller_enable && !roller_emc && roller_state == 0x03;
	}

	public boolean loadSuccess() {
		return roller_enable && !roller_emc && roller_state == 0x03;
	}

	public boolean unloadSuccess() {
		return roller_enable && !roller_emc && roller_state == 0x03;
	}

	public boolean isStop() {
		return roller_enable && !roller_emc && roller_state == 0x04;
	}
	public boolean isFailed() {
		return roller_state == 0xFF;
	}
}
